import React, { PureComponent } from 'react';
import { Card, Avatar, Icon, Tag, List, Row, Col } from 'antd';
import Link from 'umi/link';
import numeral from 'numeral';
import styles from '../../styles.less'
import resource from '../../resource';


// 设备指标框
class DeviceIndex extends PureComponent {

    render() {


        const avtars = [resource.icon.zhileng,
        resource.icon.dalou,
        resource.icon.eryanghuatannongdu,
        resource.icon.gfypt,
        resource.icon.jienenghuanbao,
        resource.icon.nuanqi,
        ];
        const indexes = [
            {
                "code": 1148855702266052600,
                "deviceCode": 1148784465791680500,
                "name": "效率",
                "type": "计算",
                "unit": "%",
                "memo": null,
                "delete": 0,
                "current": 1,
                "version": 1
            },
            {
                "code": 1148855702366715900,
                "deviceCode": 1148784465791680500,
                "name": "功率",
                "type": "计算",
                "unit": "kW",
                "memo": null,
                "delete": 0,
                "current": 1,
                "version": 1
            },
            {
                "code": 1148855702400270300,
                "deviceCode": 1148784465791680500,
                "name": "流量",
                "type": "计算",
                "unit": "m³/min",
                "memo": null,
                "delete": 0,
                "current": 1,
                "version": 1
            },
            {
                "code": 1148855702442213400,
                "deviceCode": 1148784465791680500,
                "name": "参数1",
                "type": "采集",
                "unit": "m³/min",
                "memo": null,
                "delete": 0,
                "current": 1,
                "version": 1
            },
            {
                "code": 1148855702479962100,
                "deviceCode": 1148784465791680500,
                "name": "参数2",
                "type": "采集",
                "unit": "m³/min",
                "memo": null,
                "delete": 0,
                "current": 1,
                "version": 1
            },
            {
                "code": 1148855702521905200,
                "deviceCode": 1148784465791680500,
                "name": "参数3",
                "type": "采集",
                "unit": "m³/min",
                "memo": null,
                "delete": 0,
                "current": 1,
                "version": 1
            },
            {
                "code": 1148855702563848200,
                "deviceCode": 1148784465791680500,
                "name": "参数4",
                "type": "采集",
                "unit": "m³/min",
                "memo": null,
                "delete": 0,
                "current": 1,
                "version": 1
            }
        ];

        const {mdNum}=this.props;
        return (
            <List size="small" grid={{
                gutter: 16, xs: 1,
                sm: 2,
                md: 4,
                lg: 4,
                xl:4,
                xxl: 4
            }} >

                {
                    indexes.map((item, index) => {
                        return (
                            <List.Item >

                                <List.Item.Meta
                                    avatar={<Avatar shape="square" src={avtars[index % avtars.length]} />}
                                    title={

                                        <span className={styles.spanStyle} style={{ height: '25px', width: '120px' }} >
                                            {numeral(2000).format('0,0')}   <small>{item.unit}</small> </span>
                                    }
                                    description={<span className={styles.spanStyle} style={{ fontSize: '13px' }}  >  {item.name}</span>}
                                />
                            </List.Item>)
                    })
                }

            </List>);

    }
}


export default DeviceIndex;